package com.becca.cake.dao.system;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.becca.cake.model.system.FunctionDO;
import com.becca.cake.model.system.Node;

/**
 * 功能管理DAO
 * @author hejinguo
 * @version $Id: FunctionDAO.java, v 0.1 2015-12-2 下午02:38:34
 */
@Repository
public interface FunctionDAO {
    /**
     * 查询员工对应的顶部菜单
     * @author hejinguo
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<Node> selectTopMenu(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询员工对应的功能菜单
     * @author hejinguo
     * @param map
     * @return
     */
    List<Node> selectLeftMenu(Map<String, Object> map) throws DataAccessException;

    /**
     * 根据ID查询功能信息
     * @author hejinguo
     * @param id
     * @return
     * @throws DataAccessException
     */
    Node selectFunctionById(Long id) throws DataAccessException;

    /**
     * 根据员工查询所有的按钮
     * @author hejinguo
     * @param adminId
     * @return
     * @throws DataAccessException
     */
    List<String> selectButtonFunByAdminId(Long adminId) throws DataAccessException;

    /**
     * 查询员工对应的岗位
     * @author hejinguo
     * @param adminId
     * @return
     * @throws DataAccessException
     */
    String selectAdminPosts(Long adminId) throws DataAccessException;

    /**
     * 根据id查询全部功能
     * @author hejinguo
     * @param id
     * @return
     * @throws DataAccessException
     */
    List<Node> selectAllFunctionById(Map<String, Object> map) throws DataAccessException;

    /**
     * 根据id查询单个功能信息
     * @author hejinguo
     * @param id
     * @return
     * @throws DataAccessException
     */
    FunctionDO selectFunctionDOById(String id) throws DataAccessException;

    /**
     * 添加功能信息
     * @author hejinguo
     * @param functionDO
     * @throws DataAccessException
     */
    void insetFunction(FunctionDO functionDO) throws DataAccessException;

    /**
     * 修改功能信息
     * @author hejinguo
     * @param functionDO
     * @throws DataAccessException
     */
    void updateFunctionById(FunctionDO functionDO) throws DataAccessException;

    /**
     * 根据角色ID查询拥有的功能
     * @author hejinguo
     * @param roleId
     * @return
     * @throws Exception
     */
    String selectOwnFunctionByRoleId(String roleId) throws DataAccessException;

    /**
     * 给角色授权功能
     * @author hejinguo
     * @param map
     * @throws Exception
     */
    void updateGrantRoleFunction(Map<String, Object> map) throws DataAccessException;

    /**
     * 根据roleId删除角色功能对照表
     * @author hejinguo
     * @param roleId
     * @throws DataAccessException
     */
    void deleteRoleFunctionByRoleId(String roleId) throws DataAccessException;

    /**
     * 添加角色功能信息
     * @author hejinguo
     * @param map
     * @throws DataAccessException
     */
    void insertRoleFunction(Map<String, Object> map) throws DataAccessException;

    /**
     * 根据员工编号查询功能信息
     * @author hejinguo
     * @param adminId
     * @return
     * @throws DataAccessException
     */
    List<Node> selectFunctionByAdminId(String adminId) throws DataAccessException;

}